import ChildrenComp1 from "./components/chidlrenComp1";
import React from "react";

class App extends React.Component {
  state = {
    count: 1,
  };
  handle() {
    // 修改数据 唯一
    this.setState({
      count: this.state.count + 1,
    });
  }
  render() {
    const { count } = this.state;
    return (
      <div>
        <h1>App </h1>
        <h2>count: {count}</h2>
        <button onClick={() => this.handle()}>+1</button>
        <hr />
        <ChildrenComp1
          count={count}
          handle={() => this.handle()}
        ></ChildrenComp1>
      </div>
    );
  }
}

export default App;
